<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="商城配置" name="first">
        <el-form ref="form" :model="form" label-width="110px">
          <el-form-item label="商城标题">
            <el-input v-model="form.title"></el-input>
          </el-form-item>
          <el-form-item label="商城域名">
            <el-input v-model="form.ym"></el-input>
          </el-form-item>
          <el-form-item label="域名编码">
            <el-input v-model="form.banum"></el-input>
          </el-form-item>
          <el-form-item label="商城名称">
            <el-input v-model="form.shopname"></el-input>
          </el-form-item>
          <el-form-item label="图片">
          <el-upload
              class="avatar-uploader"
              action="https://cs4.hephp.cn/api/Banlist/update"
              :show-file-list="false"
              accept=".png, .jpg, .jpeg"
              :on-success="handleAvatarSuccess">
              <img v-if="form.image" :src="form.image" class="avatar">
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-form-item>


          <el-form-item label="是否开启">
            <el-radio-group v-model="form.status">
              <el-radio :label="1">开启</el-radio>
              <el-radio :label="2">关闭</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">修改</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { getshopList,getshopEdit } from '@/api/config'
export default {
  name: 'ComplexTable',
  data() {
    return {
      activeName: 'first',
      form: {
        shopname: '',
        image: '',
        title: '',
        banum: '',
        ym: '',
        status:1
      }
    }
  },
  created() {
   this.getshopLists()
  },
  methods: {
    //获取配置信息
    getshopLists(){
      getshopList({id:1}).then(response => {
            console.log(response.data)
            this.form = response.data
        })
    },
   
    onSubmit() {
      console.log('submit!');
      getshopEdit(this.form).then(response => {
            this.$notify({
              title: 'Success',
              message: 'Update Successfully',
              type: 'success',
              duration: 2000
            })
            this.getpayLists()
        })
    },
    handleAvatarSuccess(res, file) {
      // console.log(res)
      // console.log(file)
      this.form.image = res.data;
    },
    handleClick(tab, event) {
      console.log(tab, event);
    }
  }
}
</script>
<style lang="scss" scoped>
</style>